count character occurrences in a string